<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/style.css">
<center>
	<?php 
if (isset($_POST["uname"])) {
		$name=$_POST["uname"];
		# code...
	}
	if (isset($_POST["upass"])) {
		$pass=$_POST["upass"];
		# code...
	}
	$conn=mysqli_connect("localhost","root","root","xinwenxitong") or die("链接失败！");
	//访问数据库
	mysqli_query($conn,"set names utf8");
		$sql="insert into root(username,password) values('$name','$pass')";
		$result=mysqli_query($conn,$sql);
		
		 if ($result) {
		echo "<script>
			alert('注册成功');
			location.href='login.php';
			</script>";
			# code...
		 }else{
			echo "<script>
		 	alert('注册失败');
			location.href='adduser.php';
		 	</script>";
		 }
	?>

</center>